<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="css/mui.min.css" rel="stylesheet" />
		<script src="js/jquery-3.1.1.min.js"></script>
		<script type="text/javascript" src="layui/layui.js" ></script>
		<script src="js/publicurl.js"></script>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav top-header" style="line-height: 35px;">
			
		    <a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
		    <h1 class="mui-title">空房查询</h1>
		</header>
		
		<div class="mui-content" id="content">
		    <ul id="listarea" class="mui-table-view mui-table-view-chevron">
				<!--
				<li class="mui-table-view-cell mui-media">
					<a class='mui-navigate-right' href="javascript:;">
						
						<div class="mui-media-body">
							远眺
							<p class='mui-ellipsis'>静静的看这个世界，最后终于疯了</p>
						</div>
					</a>
				</li>-->
			</ul>
		</div>
		<script src="js/mui.min.js"></script>
		<script type="text/javascript">
			
			mui.init({
				swipeBack:true//启用右滑关闭功能
			});
			
			window.onload = function(){
				getArea();
				mui.plusReady(function(){
			    //关闭等待框
			    plus.nativeUI.closeWaiting();
			 });
			  }
			
			layui.use(['form','layer'],function() {
				var form = layui.form;
				var layer = layui.layer;
				
			});
			function getArea() {
				$("#listarea").empty();
				layui.use(['form','layer'],function() {
				var form = layui.form;
				var layer = layui.layer;
				mui.ajax(puburl.url+"/dangxia/user/getAllArea", {
					data: {
					},
					dataType: 'json', //服务器返回json格式数据
					type: 'post', //HTTP请求类型
					timeout: 5000, //超时时间设置为10秒；
					success: function(data1) {
						if(data1.code==0) {
							layer.msg(data1.msg);
							/*mui("#content").pullRefresh().endPulldown();*/
							$.each(data1.data, function(index,d) {
								$("#listarea").append(
									"<li class='mui-table-view-cell mui-media'>"
								  + "<a class='mui-navigate-right' href='buildings.html?id="+d.id+"'>"
								  + "<div class='mui-media-body'>"
								  + d.areaName
								  +"<p class='mui-ellipsis'>"+d.areaAddr+"</p>"
								  + "</div>"
								  + "</a>"
								  + "</li>"
								);
							});
							
							
						} else {
							layer.msg(data1.msg);
//							mui("#content").pullRefresh().endPulldown();
						}
					},
					error: function(xhr, type, errorThrown) { //异常处理；
						layer.msg("连接异常");
//						mui("#content").pullRefresh().endPulldown();
					}
				});
				});
			}
			function openNewPage(url1,idname) {
				mui.openWindow({
				    url:url1,
				    id:idname,
				    styles:{
				      top:0,//新页面顶部位置
				      bottom:0//新页面底部位置
				    },
				    extras:{
				      id:1		//自定义扩展参数，可以用来处理页面间传值
				    },
				    createNew:false,//是否重复创建同样id的webview，默认为false:不重复创建，直接显示
				    show:{
				      autoShow:true,//页面loaded事件发生后自动显示，默认为true
				      aniShow:"slide-in-top",//页面显示动画，默认为”slide-in-right“；
				      duration:200///页面动画持续时间，Android平台默认100毫秒，iOS平台默认200毫秒；
				    },
				    waiting:{
				      autoShow:false,//自动显示等待框，默认为true
				      //title:'正在加载...',//等待对话框上显示的提示内容
				      options:{
				       /* width:waiting-dialog-widht,//等待框背景区域宽度，默认根据内容自动计算合适宽度
				        height:waiting-dialog-height,//等待框背景区域高度，默认根据内容自动计算合适高度
				        ......*/
				      }
				    }
				});
			}
		</script>
	</body>

</html>